﻿
using System;
using System.Diagnostics;
using System.Linq;
using MissingLinq.Linq2Management.Context;
using MissingLinq.Linq2Management.Model;

namespace Linq2Management.Test
{
	class Program
	{
		static void Main(string[] args)
		{
			using (var dc = new ManagementObjectContext())
			{
				Debug.WriteLine("*** processes ***");
				var processes = dc.Win32Processes.Where(s => s.ProcessId > 1).ToList();
				foreach (var service in processes)
					Debug.WriteLine("{0}\t{1}\t{2}", service.ProcessId, service.ExecutionState, service.CommandLine);

				Debug.WriteLine("*** shares ***");
				var shares = dc.Win32Shares.Where(s => s.Status == "OK").ToList();
				foreach (var share in shares)
					Debug.WriteLine("{0}\t{1}\t{2}", share.Name, share.Path, share.Description);

				Debug.WriteLine("*** Drives ***");
				var drives = dc.Win32LogicalDisks.ToList();
				foreach (var drive in drives)
					Debug.WriteLine("{0}\t{1}\t{2}\t{3}", drive.Caption, drive.DriveType, drive.MediaType, drive.Size);
			}
		}
	}
}
